package com.aaa.第二遍;

import java.lang.reflect.Method;

/**
 * @author 荆豪峰
 * @version 1.0
 */
public class d4 {
    public static void main(String[] args) throws Exception {
        Class<?> aClass = Class.forName("com.aaa.第二遍.d4.b2");
        Method f1 = aClass.getDeclaredMethod("f1");

        Object o = aClass.newInstance();
        Object result = f1.invoke(o);
        System.out.println("result = " + result);

        Method f2 = aClass.getDeclaredMethod("f2", String.class, Integer.class);
        Object o1 = f2.invoke(o, "asd", 18);
        System.out.println("o1 = " + o1);
    }
}
class b1{
    public void show(){
        System.out.println("show");
    }
    public void print(){
        System.out.println("print");
    }
}
class b2 extends b1 {
    public void f1(){
        System.out.println("f1");
    }
    public String f2(String name, Integer age ){
        System.out.println("f2"+name+age);
        return "asdd";
    }
}
